#ifndef Q_ESGL_H
#define Q_ESGL_H
#include <EGL/egl.h>
#include <GLES2/gl2.h>

typedef struct SESGL
{
	SESGL()
	{
		bNeedZbuffer		= true;
		bNeedStencilBuffer	= false;
		bNeedPBuffer		= false;
		bNeedPixmap			= false;

		nColorBPP			= 0;
		nDepthBPP			= 0;
		nFSAAMode			= 0;
	}

	SESGL( SESGL & rhs )
	{
		bNeedZbuffer		= rhs.bNeedZbuffer;
		bNeedStencilBuffer	= rhs.bNeedStencilBuffer;
		bNeedPBuffer		= rhs.bNeedPBuffer;
		bNeedPixmap			= rhs.bNeedPixmap;

		nColorBPP			= rhs.nColorBPP;
		nDepthBPP			= rhs.nDepthBPP;
		nFSAAMode			= rhs.nFSAAMode;
	}

	bool	bNeedZbuffer;
	bool	bNeedStencilBuffer;
	bool	bNeedPBuffer;
	bool	bNeedPixmap;
	int		nColorBPP;
	int		nDepthBPP;
	int		nFSAAMode;

} SESGL, *PSESGL;

class CESGL
{
public:
	CESGL(void);
	~CESGL(void);

	bool InitESGL( EGLNativeWindowType hWnd, EGLNativeDisplayType hDC = 0, EGLNativePixmapType hBitmap = 0 );

	void ReleaseESGL();

	EGLConfig ChooseConfigESGL();

	// 
	void CompleteDrawESGL();
private:
	EGLDisplay	m_glDisplay;
	EGLSurface	m_glSurface;
	EGLContext	m_glContext;
	EGLConfig	m_glConfig;
	EGLint		m_iMajorVersion;
	EGLint		m_iMinorVersion;
	EGLint		m_nConfig;
	
	EGLint		m_nRequestedConfig;

	//platform
	EGLNativeWindowType		m_glNWT;
	EGLNativeDisplayType	m_glNDT;
	EGLNativePixmapType		m_glNPT;

	SESGL					m_SESGL;
};

#endif

